<?php

/**
 * Commentaire filter form base class.
 *
 * @package    appcemhti
 * @subpackage filter
 * @author     Steve Cancès
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseCommentaireFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_lot'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Lot'), 'add_empty' => true)),
      'id_traitement'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Traitement'), 'add_empty' => true)),
      'id_echantillon' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Echantillon'), 'add_empty' => true)),
      'id_user'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => true)),
      'id_mesure'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Mesure'), 'add_empty' => true)),
      'contenu'        => new sfWidgetFormFilterInput(),
      'created_at'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'updated_at'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'visible'        => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'id_lot'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Lot'), 'column' => 'id_lot')),
      'id_traitement'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Traitement'), 'column' => 'id_traitement')),
      'id_echantillon' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Echantillon'), 'column' => 'id_echantillon')),
      'id_user'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('User'), 'column' => 'id_user')),
      'id_mesure'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Mesure'), 'column' => 'id_mesure')),
      'contenu'        => new sfValidatorPass(array('required' => false)),
      'created_at'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'visible'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('commentaire_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Commentaire';
  }

  public function getFields()
  {
    return array(
      'id_commentaire' => 'Number',
      'id_lot'         => 'ForeignKey',
      'id_traitement'  => 'ForeignKey',
      'id_echantillon' => 'ForeignKey',
      'id_user'        => 'ForeignKey',
      'id_mesure'      => 'ForeignKey',
      'contenu'        => 'Text',
      'created_at'     => 'Date',
      'updated_at'     => 'Date',
      'visible'        => 'Number',
    );
  }
}
